﻿#region using

using Microsoft.Practices.ServiceLocation;

#endregion

namespace MvcMall.Framework.UnitOfWork
{
    ///<summary>
    ///</summary>
    public static class UnitOfWork
    {
        ///<summary>
        ///</summary>
        ///<returns></returns>
        public static IUnitOfWork Begin()
        {
            return Begin(string.Empty);
        }

        ///<summary>
        ///</summary>
        ///<param name = "factoryKey"></param>
        ///<returns></returns>
        public static IUnitOfWork Begin(string factoryKey)
        {
            var uow = ServiceLocator.Current.GetInstance<IUnitOfWork>();
            uow.Init(factoryKey);
            return uow;
        }
    }
}